//
//  TTEstimateMailInfoView.m
//  TaoTuo
//
//  Created by LG on 2020/8/13.
//  Copyright © 2020 刘广. All rights reserved.
//

#import "TTEstimateMailInfoView.h"
#import <UIImageView+WebCache.h>

@interface TTEstimateMailInfoView ()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *oneLabel;
@property (weak, nonatomic) IBOutlet UILabel *oneRightLabel;

@property (weak, nonatomic) IBOutlet UILabel *twoLabel;
@property (weak, nonatomic) IBOutlet UILabel *twoRightLabel;

@property (weak, nonatomic) IBOutlet UILabel *threeLabel;
@property (weak, nonatomic) IBOutlet UILabel *threeRightLabel;

@property (weak, nonatomic) IBOutlet UIImageView *rightImgView;
@property (weak, nonatomic) IBOutlet UILabel *centerLabel;

@end

@implementation TTEstimateMailInfoView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.layer.cornerRadius = 8;
    
}


- (void)setMailTopViewWithModel:(TTEstimateDetailModel *)model
{
    self.titleLabel.text = model.Progress_Text;
    TTEstimateDatailSendingInformationModel *infoModel = model.SendingInformation;
    if (infoModel.ICON.length > 0) {
        [self.rightImgView sd_setImageWithURL:[NSURL URLWithString:infoModel.ICON] placeholderImage:nil options:SDWebImageRetryFailed];
    }
    int m = infoModel.SendMethod.intValue;
    if (m == 1) {
        [self setupMailConfigWithModel:infoModel];
    } else if (m == 2) {
        [self setupShangmenConfigWithModel:infoModel];
    } else if (m == 3) {
        [self setupDaodianConfigWithModel:infoModel];
    } else if (m == 4) {
        [self setupMianjiConfigWithModel:infoModel];
    }
    
    
}

// 邮寄
- (void)setupMailConfigWithModel:(TTEstimateDatailSendingInformationModel *)model
{
    self.oneLabel.text = @"物        流：";
    self.oneRightLabel.text = model.Express;
    self.twoLabel.text = @"运  单  号：";
    self.twoRightLabel.text = model.ExpressNumber;
    
    self.threeLabel.text = @"";
    self.threeRightLabel.text = @"";
    
    self.centerLabel.text = @"";
        
    [self mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@100);
    }];
    
}


// 上门取货
- (void)setupShangmenConfigWithModel:(TTEstimateDatailSendingInformationModel *)model
{
    if (model.SendStatus.intValue == 1) {
        self.oneLabel.text = @"上门时间：";
        self.oneRightLabel.text = model.VisitingTime;
        self.twoLabel.text = @"取  件  人：";
        self.twoRightLabel.text = model.QName;
        self.threeLabel.text = @"联系电话：";
        self.threeRightLabel.text = model.QTelPhone;
        self.centerLabel.text = @"";
    } else {
        self.oneLabel.text = @"";
        self.oneRightLabel.text = @"";
        self.twoLabel.text = @"";
        self.twoRightLabel.text = @"";
        self.threeLabel.text = @"";
        self.threeRightLabel.text = @"";
        self.centerLabel.text = @"已取货";
    }
    
    
    [self mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@120);
    }];
}

// 到店交易
- (void)setupDaodianConfigWithModel:(TTEstimateDatailSendingInformationModel *)model
{
    
    self.oneLabel.text = @"到店时间：";
    self.oneRightLabel.text = model.ArrivalTime;
    self.twoLabel.text = @"门        店：";
    self.twoRightLabel.text = model.StoreAddress;
    self.threeLabel.text = @"联系电话：";
    self.threeRightLabel.text = model.CustomerPhone;
    self.centerLabel.text = @"";
    
    [self mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@135);
    }];
}

// 免寄上架
- (void)setupMianjiConfigWithModel:(TTEstimateDatailSendingInformationModel *)model
{
    self.oneLabel.text = @"";
    self.oneRightLabel.text = @"";
    self.twoLabel.text = @"";
    self.twoRightLabel.text = @"";
    self.threeLabel.text = @"";
    self.threeRightLabel.text = @"";
    
    if (model.SendStatus.intValue == 1) {
        self.centerLabel.text = @"未审核";
    } else {
        self.centerLabel.text = @"已审核";
    }
    
    [self mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@90);
    }];
}

@end
